GenerateTextResult

data class GenerateTextResult<TOutput>(val output: TOutput, val text: String, val toolCalls: List<ContentPart.ToolCall>, val finishReason: FinishReason, val usage: Usage, val content: List<ContentPart> = buildList { if (text.isNotEmpty()) add(ContentPart.Text(text)) addAll(toolCalls) }, val toolResults: List<ContentPart.ToolResult> = content.filterIsInstance<ContentPart.ToolResult>(), val reasoning: List<ContentPart.Reasoning> = content.filterIsInstance<ContentPart.Reasoning>(), val reasoningText: String? = reasoning.takeIf { it.isNotEmpty() }?.joinToString("") { it.text }, val files: List<ContentPart.File> = content.filterIsInstance<ContentPart.File>(), val sources: List<ContentPart.Source> = content.filterIsInstance<ContentPart.Source>(), val totalUsage: Usage = usage, val warnings: List<CallWarning> = emptyList(), val request: LanguageModelRequestMetadata = LanguageModelRequestMetadata(), val response: LanguageModelResponseMetadata = LanguageModelResponseMetadata(), val providerMetadata: Map<String, JsonElement> = emptyMap(), val steps: List<StepResult> = emptyList(), val rawFinishReason: String? = null)

Constructors

Link copied to clipboard
constructor(output: TOutput, text: String, toolCalls: List<ContentPart.ToolCall>, finishReason: FinishReason, usage: Usage, content: List<ContentPart> = buildList { if (text.isNotEmpty()) add(ContentPart.Text(text)) addAll(toolCalls) }, toolResults: List<ContentPart.ToolResult> = content.filterIsInstance<ContentPart.ToolResult>(), reasoning: List<ContentPart.Reasoning> = content.filterIsInstance<ContentPart.Reasoning>(), reasoningText: String? = reasoning.takeIf { it.isNotEmpty() }?.joinToString("") { it.text }, files: List<ContentPart.File> = content.filterIsInstance<ContentPart.File>(), sources: List<ContentPart.Source> = content.filterIsInstance<ContentPart.Source>(), totalUsage: Usage = usage, warnings: List<CallWarning> = emptyList(), request: LanguageModelRequestMetadata = LanguageModelRequestMetadata(), response: LanguageModelResponseMetadata = LanguageModelResponseMetadata(), providerMetadata: Map<String, JsonElement> = emptyMap(), steps: List<StepResult> = emptyList(), rawFinishReason: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard

Tool calls/results against dynamic (runtime-typed) tools (dynamicTool(...)).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val providerMetadata: Map<String, JsonElement>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Tool calls/results against statically-typed tools (tool(...)), matching upstream's split.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
inline fun <T> GenerateTextResult<*>.providerMetadataAs(provider: String): T?
fun <T> GenerateTextResult<*>.providerMetadataAs(provider: String, serializer: KSerializer<T>): T?